﻿using System;
using Habanero.Base;
using Habanero.BO;
// ReSharper disable UnusedMember.Global
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedTypeParameter
// ReSharper disable UnusedAutoPropertyAccessor.Local
// ReSharper disable UnusedMember.Local
// ReSharper disable ClassNeverInstantiated.Global
namespace AutoMappingHabanero.Test
{   
    public enum FakeEnum
    {
        SomeNum
    }
    public class FakeAttribute: Attribute{}
    public class SomeNonBoClass { }
    public class SomeNonBoClassSubClass:SomeNonBoClass { }

    public class FakeBOfdafasd: BusinessObject
    {
        public string Someprop { get; set; }
        public FakeBOWProps somerela { get; set; }
    }

    public class FakeBOWProps : BusinessObject
    {
        public Guid FakeBOWPropsID { get; set; }
        public Guid PublicGetGuidProp { get; private set; }
        public Guid? PublicGetNullableGuidProp { get; private set; }
        public string PublicStringProp { get; private set; }
        public int PublicIntProp { get; private set; }
        public FakeEnum PublicEnumProp { get; set; } 
        public FakeEnum? PublicNullableEnumProp { get; set; }

        [FakeAttribute]
        public float? PublicPropWithAtt { get; set; }
        [AutoMapIgnore]
        public Guid PublicWithIgnoreAtt { get; set; }
    }
    public class FakeBONoPK : BusinessObject { public Guid PublicGetGuidProp { get; private set; } }
    public class FakeBOAttributePK : BusinessObject
    {
        [AutoMapPrimaryKey]
        public Guid PublicGuidProp { get; private set; }
        public Guid AnotherProp { get; private set; }
    }
    public class FakeBOTwoPropsAttributePK : BusinessObject
    {
        [AutoMapPrimaryKey]
        public Guid PublicGuidProp { get; private set; }
        [AutoMapPrimaryKey]
        public Guid AnotherPrimaryKeyProp { get; private set; }
        public Guid AnotherProp { get; private set; }

    }
    public class FakeBOAttributePKAndPKNaming : BusinessObject
    {
        [AutoMapPrimaryKey]
        public Guid PublicGuidProp { get; private set; }
        public Guid FakeBOAttributePKAndPKNamingID { get; private set; }
        public Guid AnotherProp { get; private set; }
        public BusinessObjectCollection<FakeBOWithUndefinableSingleRel> MyMultipleRevRel { get; set; }

        public BusinessObjectCollection<FakeBOWithSingleRel1> MyMultipleRevRel2 { get; set; }
    }

    public class FakeBOWithSingleRel : BusinessObject
    {
        public FakeBONoPK MySingleRelationship {get; set;}
        [AutoMapIgnore]
        public FakeBONoPK MySingleRElationshipWithIgnore {get; set;}
    }
    public class FakeBOWithSingleRel1 : BusinessObject
    {
        public FakeBOAttributePKAndPKNaming MySingleRelationship2 { get; set; }
    }
    public class FakeBOWithSingleRelAndFKProp : BusinessObject
    {
        public FakeBONoPK MySingleRelationship {get; set;}
        public Guid? MySingleRelationshipID {get; set;}
    }

    public class FakeBOWithOneToOneAttribute : BusinessObject
    {
        [AutoMapOneToOne]
        public FakeBONoPK MySingleRelationship {get; set;}

        public Guid? MySingleRelationshipID {get; set;}
    }

    public class FakeBOWithReverseSingleRel : BusinessObject
    {
        /// <summary>
        /// Mapped to MyReverseSingleRel Relationship.
        /// </summary>
        public FakeBOWithTwoSingleRel MySingleRelationship {get; set;}
    }

    public class FakeBOWithTwoSingleRel : BusinessObject
    {
        public FakeBONoPK MySingleRelationship {get; set;}

        public FakeBOWithReverseSingleRel MyReverseSingleRel {get; set;}

    }
    public class FakeBOWithTwoSingleRelNoRevs : BusinessObject
    {
        public FakeBONoPK MySingleRelationship {get; set;}

        public FakeBONoPK MySecondSingleRelationship {get; set;}
    }



    public class FakeBOWithUndefinableSingleRel : BusinessObject
    {
        public FakeBOWithSingleAndMultipleRelToSameType MySingleRelationship {get; set;}

        [AutoMapOneToOne]
        public FakeBOWithSingleAndMultipleRelToSameType MySingleRelWithOneToOneAttribute {get; set;}

        [AutoMapManyToOne]
        public FakeBOWithSingleAndMultipleRelToSameType MySingleRelWithOneToManyAttribute {get; set;}
    }

    public class FakeBOWithSingleAndMultipleRelToSameType : BusinessObject
    {
        public FakeBOWithUndefinableSingleRel MySingleRevRel {get; set;}

        public BusinessObjectCollection<FakeBOWithUndefinableSingleRel> MyMultipleRevRel {get; set;}
    }

    public class FakeBoWithMultipleRel:BusinessObject
    {
        public BusinessObjectCollection<FakeBOWithUndefinableSingleRel> MyMultipleRevRel {get; set;}

        public IBusinessObjectCollection FakeBOWithUndefinableSingleRels {get; set;}

        [AutoMapIgnore]
        public IBusinessObjectCollection MultipleRevIgnores {get; set;}

        public BusinessObjectCollection<FakeWithTwoSingleReverseRel> MyMultipleWithTwoSingleReverse {get; set;}
        [AutoMapOneToMany("MySingleRelationship2")]
        public BusinessObjectCollection<FakeWithTwoSingleReverseRel> MyMultipleAutoMapWithTwoSingleReverse {get; set;}
        [AutoMapIgnore]
        public BusinessObjectCollection<FakeWithTwoSingleReverseRel> MyMultipleWithTwoSingleReverseThisIgnore {get; set;}
        public BusinessObjectCollection<FakeBOTwoSingleOneIgnore> MyMultipleWithTwoSingleReverseOneIgnore {get; set;}
        public BusinessObjectCollection<FakeBoWithAutoMapOneToOne> ReverseHasAutoMapOneToOne { get; set; }

        public BusinessObjectCollection<FakeWithThreeSingleReverseRelOneAutoMapped> MyMultipleReverseAutoMapped {get; set;}

        public FakeBOWithSingleAttributeDeclaredRevRel SingleRel { get; set; }

        [AutoMapOneToMany("NonExistentReverseRel")]
        public BusinessObjectCollection<FakeWithThreeSingleReverseRelOneAutoMapped> MultipleMappedToNonExistentReverse { get; set; }
        [AutoMapOneToOne]
        public FakeWithTwoSingleReverseRel MySingleWithTwoSingleReverse { get; set; }

    }

    public class FakeBoWithAutoMapOneToOne : BusinessObject
    {
        [AutoMapOneToOne]
        public FakeBoWithMultipleRel MySingleRelationship1 { get; set; }
    }

    public class FakeWithTwoSingleReverseRel : BusinessObject
    {
        public FakeBoWithMultipleRel MySingleRelationship1 {get; set;}

        public FakeBoWithMultipleRel MySingleRelationship2 {get; set;}
    }

    public class FakeBOTwoSingleOneIgnore : BusinessObject
    {
        public FakeBoWithMultipleRel MySingleRelationship1 {get; set;}

        [AutoMapIgnore]
        public FakeBoWithMultipleRel MySingleRelationship2 {get; set;} 
    }

    public class FakeWithThreeSingleReverseRelOneAutoMapped : BusinessObject
    {
        
        public FakeBoWithMultipleRel MySingleRelationship1 {get; set;}
        public FakeBoWithMultipleRel MySingleRelationship2 {get; set;}
        [AutoMapManyToOne("MyMultipleReverseAutoMapped")]
        public FakeBoWithMultipleRel MySingleRelationship3 {get; set;}
    }

    public class FakeBOWithSingleAttributeDeclaredRevRel : BusinessObject
    {
        [AutoMapManyToOne(ReverseRelationshipName = "AttributeRevRelName")]
        public FakeBOWithUndefinableSingleRel MySingleRelationship {get; set;}
    }

    public class FakeBOWithReverseSingle : BusinessObject
    {
        public FakeBOWithM1Attribute MySingleRelationship {get; set;}
        [AutoMapOneToOne("MySingleRevRelationship")]
        public FakeBOWith11Attribute MySingleRelationship2 {get; set;}
        [AutoMapOneToOne("NoRevRel")]
        public FakeBOWith11Attribute MySingleWithAutoMapNoReverse { get; set; }
        public FakeBOWith11Attribute MySingleRelationship3 {get; set;}
        [AutoMapIgnore]
        public FakeBOWith11Attribute MySingleIgnorRelationship { get; set; }
        public FakeBOWithIgnoreAttribute MySingleWithReverseIgnore { get; set; }
        public FakeBOWithOneSingleRel SingleWithRevesre { get; set; }
    }

    public class FakeBOWithReverseSingleToInterface : BusinessObject
    {
        [AutoMapOneToOne]
        public IFakeBO MySingleRelationship { get; set; }
    }

    public class FakeBOWithOneSingleRel : BusinessObject
    {
        public FakeBOWithReverseSingle ReverseSingleRel { get; set; }
    }
    public class FakeBOWith11Attribute : BusinessObject
    {
        public FakeBOWithReverseSingle MySingleRevRelationship { get; set; }
        public FakeBOWithReverseSingle MySingleRelationship2 { get; set; }
    }
    public class FakeBOWithTwo11Rels : BusinessObject
    {
        [AutoMapOneToOne]
        public FakeBoNoProps MyOneToOne { get; set; }
        [AutoMapOneToOne]
        public FakeBoNoProps MyOneToOne2 { get; set; }
    }
    public class FakeBOWithIgnoreAttribute : BusinessObject
    {
        [AutoMapIgnore]
        public FakeBOWithReverseSingle MySingleRelationship1 { get; set; }
    }

    public class FakeBOWithM1Attribute : BusinessObject
    {
        [AutoMapManyToOne]
        public FakeBOWithReverseSingle MySingleRelationshipRev {get; set;}
    }


    public class FakeBOWithOneM21_AndOne121 : BusinessObject
    {
        [AutoMapManyToOne(ReverseRelationshipName = "xxxs")]
        public FakeBOWithReverseSingle MySingleRel1 { get; set; }
        [AutoMapOneToOne(ReverseRelationshipName = "yyyy")]
        public FakeBOWithReverseSingle MySingleRel2 { get; set; }
    }
    public class FakeBOWithOne12M : BusinessObject
    {
        [AutoMapOneToMany(ReverseRelationshipName = "xxxs")]
        public BusinessObjectCollection<FakeBOWithReverseSingle> MyMultRel { get; set; }
        [AutoMapOneToMany(ReverseRelationshipName = "yyyy")]
        public BusinessObjectCollection<FakeBOWithReverseSingle> MyMultRell2 { get; set; }
    }

    public class FakeBOWithAllTypesOfRel : BusinessObject
    {
        [AutoMapOneToMany(ReverseRelationshipName = "xxxs")]
        public BusinessObjectCollection<FakeBOWithReverseSingle> MyMultRel { get; set; }
        [AutoMapOneToMany(ReverseRelationshipName = "yyyy")]
        public BusinessObjectCollection<FakeBOWithReverseSingle> MyMultRell2 { get; set; }

        [AutoMapManyToOne(ReverseRelationshipName = "xxxs")]
        public FakeBOWithReverseSingle MySingleRel1 { get; set; }

        [AutoMapOneToOne]
        public FakeBoWithMultipleRel MySingleRelationship1 { get; set; }
        [AutoMapOneToOne]
        public FakeBoWithMultipleRel MySingleRelationship2 { get; set; }
        [AutoMapOneToOne]
        public FakeBoWithMultipleRel MySingleRelationship3 { get; set; }

        [AutoMapIgnore]
        public FakeBOWith11Attribute MySingleIgnoreRelationship { get; set; }
        [AutoMapIgnore]
        public BusinessObjectCollection<FakeBOWithReverseSingle> MyMultIgnoreRel { get; set; }

        public Guid FakeBOWPropsID { get; set; }
        public Guid PublicGetGuidProp { get; private set; }
        public Guid? PublicGetNullableGuidProp { get; private set; }
        public string PublicStringProp { get; private set; }
        public int PublicIntProp { get; private set; }
        public FakeEnum PublicEnumProp { get; set; }
        public FakeEnum? PublicNullableEnumProp { get; set; }
    }

    public class FakeBoWithNoSingleReverse : BusinessObject
    {
        public FakeBOWithUndefinableSingleRel MySingleRelationship {get; set;}
    }
    public class FakeBoWithStaticProperty : BusinessObject
    {
        [AutoMapOneToOne]
        public static FakeBoNoProps MySingleRelationship { get; set; }
        [AutoMapManyToOne]
        public static FakeBoNoProps MySingleRelationship2 { get; set; }
        public static BusinessObjectCollection<FakeBoNoProps> MyMultiple { get; set; }
        public static string PublicStringProp { get; private set; }
    }

    public class FakeBoWithPrivateProps : BusinessObject
    {
        [AutoMapOneToOne]
        private FakeBoNoProps PrivateOneToOneRel { get; set; }
        [AutoMapManyToOne]
        private FakeBoNoProps PrivateManyToOneRel { get; set; }

        private BusinessObjectCollection<FakeBoNoProps> PrivateMultipleRel { get; set; }

        private string PrivateStringProp { get;  set; }
        public string PublicStringProp { get;  private set; }
        protected string ProtectedStringProp { get;  set; }
        internal string InternalStringProp { get;  set; }
    }

    [AutoMapIgnore]
    public class FakeBoIgnore : BusinessObject
    {
        public FakeBOWithUndefinableSingleRel MySingleRelationship { get; set; }
    }

    public class FakeManyToOneBoRelNoFK : BusinessObject
    {
        public FakeBOWithNoRelationship MySingleRelationship { get; set; }
    }
    
    public class FakeBOWithNoRelationship : BusinessObject
    {
    }

    public class FakeBOWithMultipleRel : BusinessObject
    {
        public BusinessObjectCollection<FakeBOWithNoRelationship> MyMultipleRel { get; set; }
    }

    public class FakeBOWithOneToOneRel : BusinessObject
    {
        [AutoMapOneToOne]
        public FakeBOWithNoRelationship MyMultipleRel { get; set; }
    }

    public class FakeBOSuperClass : BusinessObject
    {
    }
    public class FakeBOSubClass : FakeBOSuperClass
    {
    }
    public class FakeBOSubSubClass : FakeBOSubClass
    {
    }
    public class FakeBoNoProps : BusinessObject
    {
    }

    public interface IFakeBO:IBusinessObject
    {
        string FakeBOSuperClassWithDescType { get; set; }
    }

    public class FakeBOSuperClassWithDesc : BusinessObject, IFakeBO
    {
        public string FakeBOSuperClassWithDescType { get; set; }
    }
    public class FakeBOSubClassSuperhasDesc : FakeBOSuperClassWithDesc
    {
    }
    public class FakeBOSubSubClassSuperHasDesc : FakeBOSubClassSuperhasDesc
    {
    }

    public class FakeBOSubClassWithRelationships : FakeBOSuperClass
    {
        public BusinessObjectCollection<FakeBoNoProps> MultipleRel { get; set; }
        public FakeBoNoProps SingleRel { get; set; }
    }


}
namespace AutoMappingHabanero.Test.ValidFakeBOs
{
    public class FakeBOSuperClass : BusinessObject
    {
    }
    public class FakeBOSubClass : FakeBOSuperClass
    {
    }
    public class FakeBOSubSubClass : FakeBOSubClass
    {
    }
    public class FakeBoNoProps : BusinessObject
    {
    }
    public class FakeBOSubClassWithRelationship : FakeBOSuperClass
    {
        public BusinessObjectCollection<FakeBoNoProps> MultipleRel { get; set; }
        public FakeBoNoProps SingleRel { get; set; }
    }
    //This returns an Error due to the ClassName being pluralised
    //The consequence is that the Reverse Relationship for both the
    // single and multiple is created as FakeBOSubClassWithRelationships
    //this results in both these relationships mapping to
    // Same reverse but reverse has diff relProps and is
    // different cardinality
//    public class FakeBOSubClassWithRelationships : FakeBOSuperClass
//    {
//        public BusinessObjectCollection<FakeBoNoProps> MultipleRel { get; set; }
//        public FakeBoNoProps SingleRel { get; set; }
//    }
    public class FakeBOWithNoRelationship : BusinessObject
    {
    }

    public class FakeBOWithMultipleRel : BusinessObject
    {
        public BusinessObjectCollection<FakeBOWithNoRelationship> MultipleRel { get; set; }
    }

    public class FakeBOWithOneToOneRel : BusinessObject
    {
        [AutoMapOneToOne]
        public FakeBOWithNoRelationship MyMultipleRel { get; set; }
    }
    public class FakeBOWithCompulsoryProp:BusinessObject
    {
        [AutoMapCompulsory]
        public String CompulsoryProp { get; set; }
        public String NonCompulsoryProp { get; set; }
        [AutoMapCompulsory]
        public FakeBOWithMultipleRel CompulsorySingleRelationship { get; set; }
        [AutoMapManyToOne(ReverseRelationshipName = "AnyName")]
        public FakeBOWithMultipleRel NonCompulsorySingleRelationship { get; set; }
    }

}
// ReSharper restore UnusedMember.Global
// ReSharper restore UnusedAutoPropertyAccessor.Local
// ReSharper restore UnusedMember.Local
// ReSharper restore ClassNeverInstantiated.Global